{include file="public/_meta" title="新增接口"/}
<article class="page-container">
	<form action="" method="post" class="form form-horizontal" id="form-api-add">

		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>接口名称：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" placeholder="请输入接口名称"  name="api_name">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>接口地址：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" placeholder="如：api/index/index"  name="api_url">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>请求类型：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" placeholder="如：post、get、put、delete"  name="request_type">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>路由类型：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" placeholder="如：普通模式、路由模式"  name="route_type">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>加密串：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea type="text" class="textarea" placeholder="请输入加密串生成描述以及加密参数" name="aes_code"></textarea>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>接口参数：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea type="text" class="textarea" placeholder="请输入接口参数" name="api_param"></textarea>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>返回数据：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea type="text" class="textarea" placeholder="请输入换回数据类型" name="return_data"></textarea>
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-9 col-sm-10 col-xs-offset-3 col-sm-offset-2">
				<button type="submit" class="btn btn-success radius" id="api-add"><i class="icon-ok"></i> 添加</button>
				<button onClick="parent.layer.close(parent.layer.getFrameIndex(window.name));" class="btn btn-success size-M radius" type="button">取消</button>
			</div>
		</div>
	</form>
</article>

<!--_footer 作为公共模版分离出去-->
{include file="public/_footer" /}
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本--> 

<script type="text/javascript">
	
	$("#form-api-add").validate({
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			var data = $(form).serializeArray();
			$(form).ajaxSubmit({
				type: 'post',
				url: "{:url('api/add_api')}",
				dataType: 'json',
				data: data,
				success: function(msg){
				    if(msg.status == true){
                        layer.msg(msg.message,{icon: 6,time:1000});
                        setTimeout(jump,1000);
                        function jump(){
                            parent.location.reload();
                        }
					}else if(msg.status == false){
                        layer.msg(msg.message,{icon: 5,time:2000});
					}
				}
			});
		}
	});
</script>

